<!-- 2017-12-4 14:24:12 | 修改 木遥（微信:  http://marsgis.cn/weixin.html ） -->
<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0" />
    <meta name="apple-touch-fullscreen" content="yes" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="x5-fullscreen" content="true" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />

    <!-- 标题及搜索关键字 -->
    <meta name="keywords" content="火星科技,cesium,3D,GIS,marsgis,三维,地球,地图,开发,框架,系统,示例,资料,模型,离线,外包,合肥,安徽,中国" />
    <meta
      name="description"
      content="火星科技 合肥火星 合肥火星科技 合肥火星科技有限公司 leaflet leaflet框架 leaflet开发 cesium cesium开发 cesium框架 三维 地球 模型  gis marsgis 地图离线 地图开发 地图框架 地图外包 框架 开发 外包  地图离线 二维地图 三维地图 全景漫游 地理信息系统 云GIS 三维GIS GIS平台 WebGIS"
    />

    <link rel="shortcut icon" type="image/x-icon" href="/img/favicon/favicon.ico" />
    <title>卫星过境分析 | Mars3D | 三维地图 | 火星科技 | 合肥火星科技有限公司</title>

    <script
      type="text/javascript"
      src="/lib/include-lib.js"
      libpath="/lib/"
      include="jquery,layer,toastr,font-awesome,jedate,web-icons,bootstrap,bootstrap-table,layer,toastr,nprogress,haoutil,mars3d,mars3d-space"
    ></script>
    <link href="/css/style.css" rel="stylesheet" />
  </head>

  <body class="dark">


    <div id="mars3dContainer" class="mars3d-container"></div>

    <!-- 面板 -->
    <div class="infoview">
      <table class="mars-table">
        <tr>
          <td class="nametd">过境区域：</td>
          <td>
            <input type="button" class="btn btn-primary" value="框选" id="drawRectangle" />
            <input type="button" class="btn btn-primary" value="圆形" id="drawCircle" />
            <input type="button" class="btn btn-primary" value="多边形" id="drawPolygon" />
            <input type="button" class="btn btn-primary" value="清除" id="drawClear" />
          </td>
        </tr>

        <tr>
          <td class="nametd">开始时间：</td>
          <td>
            <input type="text" class="form-control" id="txtStartTime" placeholder="YYYY-MM-DD" />
          </td>
        </tr>
        <tr>
          <td class="nametd">结束时间：</td>
          <td>
            <input type="text" class="form-control" id="txtEndTime" placeholder="YYYY-MM-DD" />
          </td>
        </tr>
        <tr>
          <td class="nametd"></td>
          <td>
            <input type="button" class="btn btn-primary" value="开始分析" onclick="startAnalysis()" />
            <input type="button" class="btn btn-primary" value="清除" onclick="clearRst()" />
          </td>
        </tr>
      </table>

      <table id="table"></table>
    </div>

    <script src="/js/common.js"></script>
    <script src="./map.js"></script>
    <script type="text/javascript">
      "use script" //开发环境建议开启严格模式
      let $table

      eventTarget.on("dataList", (e) => {
        // pathData.value = e.tableList
        $table.bootstrapTable("load", e.tableList)
        console.log("data", e.tableList)
      })

      function initUI(options) {
        //加载示例数据
        // eslint-disable-next-line prettier/prettier
        // let hostiryData = {"startDate":"2021-05-31 19:56:18","endDate":"2021-05-31 20:56:18","geojson":{"type":"Feature","properties":{"id":"M-676224DB-E1C7-492B-BD4F-11245263E921","type":"rectangle","style":{"color":"#ffff00","opacity":0.2,"outline":true,"outlineColor":"#ffffff","materialType":"Color","clampToGround":false,"height":-1253.05}},"geometry":{"type":"Polygon","coordinates":[[[76.021252,46.81116,-1253.1],[152.705424,1.598719,-7200.1]]]}}}
        // $('#txtStartTime').val(hostiryData.startDate) //开始时间
        // $('#txtEndTime').val(hostiryData.endDate) //结束时间
        // drawGraphic = map.graphicLayer.loadGeoJSON(hostiryData.geojson)[0]
        init()
      }

      function init() {
        // eslint-disable-next-line no-undef
        jeDate("#txtStartTime", {
          theme: {
            bgcolor: "#135b91",
            pnColor: "#00CCFF"
          },
          format: "YYYY-MM-DD hh:mm:ss",
          zIndex: 20210825
        })
        // eslint-disable-next-line no-undef
        jeDate("#txtEndTime", {
          theme: {
            bgcolor: "#135b91",
            pnColor: "#00CCFF"
          },
          format: "YYYY-MM-DD hh:mm:ss",
          zIndex: 20210825
        })

        let now = Cesium.JulianDate.toDate(map.clock.currentTime)
        $("#txtStartTime").val(now.format("yyyy-MM-dd HH:mm:ss"))

        now.setMinutes(now.getMinutes() + 60)
        $("#txtEndTime").val(now.format("yyyy-MM-dd HH:mm:ss"))

        //框选查询 矩形
        $("#drawRectangle").click(function () {
          drawRectangle()
        })
        //框选查询   多边
        $("#drawPolygon").click(function () {
          drawPolygon()
        })
        //框选查询   圆
        $("#drawCircle").click(function () {
          drawCircle()
        })

        $("#drawClear").click(function () {
          clearRst()
        })

        $table = $("#table")
        $table.bootstrapTable({
          height: 300,
          singleSelect: true, //单选
          pagination: false,
          iconsPrefix: "fa",
          columns: [
            {
              field: "name",
              title: "卫星名称",
              sortable: true,
              editable: false,
              align: "left"
            },
            {
              field: "inTime",
              title: "进入时间",
              sortable: true,
              editable: false,
              align: "left"
            },
            {
              field: "outTime",
              title: "飞出时间",
              sortable: true,
              editable: false,
              align: "left"
            },
            {
              field: "often",
              title: "飞行时长",
              sortable: true,
              editable: false,
              align: "left"
            },
            {
              field: "distance",
              title: "飞行距离",
              sortable: true,
              editable: false,
              align: "left"
            }
          ],
          onClickRow: function (item, $element, field) {
            let graphic = item._graphic
            if (graphic == null) {
              // eslint-disable-next-line no-undef
              toastr.warning(item.name + " 无经纬度坐标信息！")
              return
            }
            graphic.flyTo()
          }
        })
      }

      function startAnalysis() {
        let startDate = new Date($("#txtStartTime").val()) //开始时间
        let endDate = new Date($("#txtEndTime").val()) //结束时间

        let startTimes = startDate.getTime()
        let endTimes = endDate.getTime()

        startFX(startTimes, endTimes)
      }

      //清除效果
      function clearRst() {
        $table.bootstrapTable("load", [])
        clearResult()
      }
    </script>
  </body>
</html>
